
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * laser_entradas_agregar.java
 *
 * Created on 24/10/2011, 04:21:16 PM
 */

package sie_invdis;

import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
import java.text.*;
import java.text.ParseException;


/**
 *
 * @author Michelle
 */
public class laser_entradas_agregar extends javax.swing.JFrame {

    private javax.swing.table.DefaultTableModel jtable_modelo_maquilla;
    private bd_conexion x = new bd_conexion() ;
       //se creaa la variable resultset
      private ResultSet rs = null;
      int controlcombo=0;


    /** Creates new form laser_entradas_agregar */
    public laser_entradas_agregar() {
        this.iniciar_modelo_de_tabla();
        initComponents();

        java.util.Date fechahoya=new Date();

        this.jdc_fechadocto.setDate(fechahoya);
        this.loadcomtiposmaquila();
        this.loadcomclientes();
        this.loadcom_operador();
        
        this.jlbl_mensajeidinsumo.setText("");
        this.jcmbx_operador.requestFocus();

        jtb_insumos.getColumnModel().getColumn(0).setPreferredWidth(60);//status
        jtb_insumos.getColumnModel().getColumn(1).setPreferredWidth(150);//Folio
        jtb_insumos.getColumnModel().getColumn(2).setPreferredWidth(30);//status
        jtb_insumos.getColumnModel().getColumn(3).setPreferredWidth(50);//doc ant.
        jtb_insumos.getColumnModel().getColumn(4).setPreferredWidth(30);//fecha
        jtb_insumos.getColumnModel().getColumn(5).setPreferredWidth(30);//fecha llega tienda
        jtb_insumos.getColumnModel().getColumn(6).setPreferredWidth(30);//f.recepcion
        jtb_insumos.getColumnModel().getColumn(7).setPreferredWidth(50);//Dias Trans.
        jtb_insumos.getColumnModel().getColumn(8).setPreferredWidth(80);//Cliente
        jtb_insumos.getColumnModel().getColumn(9).setPreferredWidth(50);//Dias Trans.
    }


private void iniciar_modelo_de_tabla()
    {
        jtable_modelo_maquilla=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_maquilla.addColumn("<html><b>Clave</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Descripcion</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Unidad</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Minutos</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Costo</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Desc.</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>I.v.a.</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Importe.</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Observaciones</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>cantidad</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Ancho.M.</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Uso Aprox.</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Precio Pieza</b></html>");

    }
private void loadcomtiposmaquila()
    {
            this.jcmbx_tipmaquila.addItem("0"+":"+"ELEGIR TIPO MAQUILA");
            try
            {
                rs = x.sieuno_executediversosv2("select * from x1distribucion_laser_artic_insumosentrada_doctos_tipomaquila() as (id smallint,descrip text,observa text);",variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcmbx_tipmaquila.addItem(rs.getString("id")+":"+rs.getString("descrip"));
                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }

    }
private void loadcomclientes()
    {
            this.jcmbx_tiendaclie.addItem("0"+":"+"ELEGIR CLIENTE");
            try
            {
                rs = x.sieuno_executediversosv2("select * from x1distribucion_laser_ventas_clientes() as (id character varying(12),descrip character varying(60));",variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcmbx_tiendaclie.addItem(rs.getString("id")+":"+rs.getString("descrip"));
                    }
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }
private void loadcom_operador()
    {
            this.jcmbx_operador.addItem("0"+":"+"ELEGIR OPERADOR");
            try
                {
                rs = x.sieuno_executediversosv2("select * from x1distribucion_laser_artic_insumosentrada_doctos_operador() as (id integer,descrip text);",variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcmbx_operador.addItem(rs.getString("id")+":"+rs.getString("descrip"));
                    }
                }
            catch(Exception e)
                {
                    System.out.println(e.getMessage());
                }
    }
private void calcularcortexpieza()
    {
        DecimalFormat miformat = new DecimalFormat("###,###,###,###.####");
         float minutos=0,costo=0,tiempominutos=0,costoproduccion=0;
         tiempominutos=(Float.valueOf(this.jtf_segundos.getText())/60)+Float.valueOf(this.jtf_minutos.getText());
         costoproduccion=tiempominutos*Float.valueOf(this.jtf_precioinsimo.getText());
         costo=costoproduccion/Float.valueOf(this.jtf_pzasreferencia.getText());
         this.jtf_precioinsumo.setText(miformat.format(costo));

         this.jtf_factor.setText(miformat.format(tiempominutos/Float.valueOf(this.jtf_pzasreferencia.getText())));
         minutos=Float.valueOf(this.jtf_factor.getText())*Float.valueOf(this.jtf_canpzaingresa.getText());
         this.jtf_minutosaprox.setText(miformat.format(minutos));
    }

private void articulo_agregar(String idinsu,String cantidad,String minutos)
    {
    String piezasxfilas[]=null,totfilass[]=null,alturausadas[]=null,puentedetexto="",puentefnece="";
    float piezasxfila=0,totfilas=0,alturausada=0,filaajuste=0,filasneceenteras=0;
    if(JOptionPane.showConfirmDialog(null, "<html><b><h3>Pz="+cantidad+" Precio:"+this.jtf_precioinsumo.getText()+"</h3></b> Desea Agregar este Articulo?</html>")==0)
         {
            DecimalFormat miformat = new DecimalFormat("###,###,###,###.####");
            int controlfolio=0;
                    String texto="select * from x1distribucion_laser_artic_insumos_insert('"+idinsu.toUpperCase().trim()+"','',1,'"+this.jtf_insumodescripcion.getText().trim().toUpperCase().replace(",", "")+"','"+this.jtf_item.getText().trim().toUpperCase()+"','"+this.jtf_unidadsal.getText().trim().toUpperCase()+"','"+this.jtf_unidadsal.getText().trim().toUpperCase()+"',"+this.jtf_factor.getText()+",'','0','0','0','',"+this.jtf_anchopieza.getText().trim()+","+this.jtf_altodepieza.getText().trim()+","+this.jtf_precioinsimo.getText().trim()+",0,0,0,0,'',0,0,'','','') as (idinsumo character varying(16),descripcion character varying(80),item character varying(16),unidad character varying(3),factor numeric,smin numeric,smax numeric,precio numeric);";

                    System.out.println(texto);


                    try {
                        rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                        while (rs.next())
                            {
                                    filaajuste=0;
                                    controlfolio=1;
                                    //JOptionPane.showMessageDialog(null,"Articulo Agregado Correctamente", "Sistema Integral(Agregar Articulo) : Confirmacion",1);
                                    piezasxfila=Float.parseFloat(this.jtf_anchomaterial.getText())/rs.getFloat("smin");
                                    puentedetexto=miformat.format(piezasxfila).replace(".", ":").replace(",", ":");
                                    piezasxfilas=puentedetexto.split(":");
                                    System.out.println(piezasxfila);
                                    System.out.println(piezasxfilas[0]);
                                    totfilas=Float.parseFloat(cantidad)/Float.parseFloat(piezasxfilas[0]);
                                    //System.out.println(totfilas);
                                     puentefnece=miformat.format(totfilas).replace(".", ":").replace(",", ":");
                                     totfilass=puentefnece.split(":");
                                     filasneceenteras=Float.parseFloat(totfilass[0]);
                                     if (totfilas>filasneceenteras)
                                        {
                                            filaajuste=1;
                                        }
                                    puentefnece=miformat.format(Float.parseFloat(totfilass[0])+filaajuste);
                                    alturausada=Float.parseFloat(puentefnece)*rs.getFloat("smax");
                                    //System.out.println(alturausada);
                                    jtable_modelo_maquilla.addRow(new Object[]{rs.getString("idinsumo"),rs.getString ("descripcion"),rs.getString ("unidad"),miformat.format(Float.valueOf(this.jtf_factor.getText())*(Float.valueOf(cantidad))),miformat.format(Float.valueOf(this.jtf_precioinsimo.getText())),this.jtf_descuento.getText().trim(),this.jtf_impuesto.getText().trim(),0,this.jtf_observacion.getText().toUpperCase(),cantidad,this.jtf_anchomaterial.getText(),miformat.format(alturausada)+"="+miformat.format(alturausada/100)+" MT",0});
                                    this.jtf_idinsumo.setText("");
                                    this.jtf_insumodescripcion.setText("");
                                    this.jtf_item.setText("");
                                    this.jtf_canpzaingresa.requestFocus();
                                  
                            }
                    } catch(Exception e)
                        {
                              System.out.println(e.getMessage());
                              JOptionPane.showMessageDialog(null,"Error conexion", "Sistema Integral(Integral) : Error",1);
                        }
                    if (controlfolio == 0 )
                            {
                                        JOptionPane.showMessageDialog(null,"Error Verifique Articulo", "Sistema Integral(Agregar Insumo) : Error",1);
                            }
                    else
                            {
                                this.calcularimportes();
                            }
                

        }
    }

private void documento_guardar()
    {
        ResultSet rs = null;
        float cantidad=0;
        int nobjetotabla=this.jtb_insumos.getRowCount();
        int fi=0,controlfolio=0;
        String cadenafilas="{'", arreglo_articulos[]=null;
        JPasswordField pwd = new JPasswordField(10);
        //this.quitarfotosestereporte();
        //lanso la confirmacion de password
               for(fi=0;fi<nobjetotabla;fi++)
                {
                    try {
                        cantidad = Float.valueOf(this.jtb_insumos.getValueAt(fi, 3).toString()).floatValue();
                    } catch (NumberFormatException nfe) {
                        cantidad=0;
                    }
                    // System.out.println("cachar error"+cadenafilas);
                    if (cantidad > 0) {
                        cadenafilas+=""+this.jtb_insumos.getValueAt(fi, 3).toString()+":"+this.jtb_insumos.getValueAt(fi, 0).toString()+":"+this.jtb_insumos.getValueAt(fi, 4)+""+"\n";
                    }
                }//fin del for

                //System.out.println(s);
                //arreglo_articulos=cadenafilas.split(":");

                if(JOptionPane.showConfirmDialog(null, "Documento sera Guardado. Estan correcto sus Datos?")==0)
                    {

                    //this.quitardescripcion();
                    java.util.Vector arreglodearticulos=this.jtable_modelo_maquilla.getDataVector();

                    String articulos_papostgresql=arreglodearticulos.toString();
                    articulos_papostgresql=articulos_papostgresql.replace('[','{');
                    articulos_papostgresql=articulos_papostgresql.replace(']','}');
                    articulos_papostgresql=articulos_papostgresql.replace("null",".");
                    String arreglo_clie[]=this.jcmbx_tiendaclie.getSelectedItem().toString().split(":");
                    String arreglo_ope[]=this.jcmbx_operador.getSelectedItem().toString().split(":");
                    //String arreglo_depa[]=this.jcmbx_depa.getSelectedItem().toString().split(":");
                    //String arreglo_alma[]=this.jcmbx_almacenes.getSelectedItem().toString().split(":");
                    String arreglo_tipoinsu[]=this.jcmbx_tipmaquila.getSelectedItem().toString().split(":");
                    String texto="select * from x1distribucion_laser_artic_insumosentrada_doctos_insert('"+arreglo_clie[0]+"','"+arreglo_ope[0]+"','"+this.fechaamericana(this.jdc_fechadocto.getDate())+"','"+this.fechaamericana(this.jdc_fechadocto.getDate())+"',"+Float.valueOf(this.jtf_descuento.getText().trim())+","+Float.valueOf(this.jtf_impuesto.getText().trim())+",'"+this.jtf_observaciones.getText().toUpperCase().replace(",", "").replace("]", "").replace("[", "").replace("{", "").replace("}", "")+"','0',"+"0"+",'"+arreglo_tipoinsu[0]+"','"+articulos_papostgresql+"')";
                    System.out.println(texto);
                    try {
                        rs=x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                        while (rs.next()) {
                            controlfolio=rs.getInt(1);
                            if (rs.getInt(1) > 0)
                                    {
                                        JOptionPane.showMessageDialog(null,"Documento "+controlfolio+"Correcto, Gracias", "Sistema Integral(Corte Laser) : Confirmacion",1);
                                        this.imprimir(0,1,controlfolio);
                                        this.Limpiar();
                                    }
                                else
                                    {
                                        JOptionPane.showMessageDialog(null," Error Verifique sus Cantidades", "Sistema Integral(Corte Laser) : Error",1);
                                    }
                        }

                    } catch(Exception e) {
                        System.out.println(e.getMessage());
                        JOptionPane.showMessageDialog(null," Recepcion Incorrecta ", "Sistema Integral(Corte Laser) : Error",1);
                    }
                }//fin del if qu confirmo guardar diferencia
    }


private void articulo_buscar(int opcion,String textobus,String cantidad,String minutos)
{
    DecimalFormat miformat = new DecimalFormat("###,###,###,###.####");
     DecimalFormat miformatusado = new DecimalFormat("###,###,###,###");
     DecimalFormat miformatpre = new DecimalFormat("############.####");
     DecimalFormat miformatseg = new DecimalFormat("############");
    int controlfolio=0;

    String piezasxfilas[]=null,totfilass[]=null,alturausadas[]=null,puentedetexto="",puentefnece="",totalmatusado[]=null;
    float piezasxfila=0,totfilas=0,alturausada=0,filaajuste=0,filasneceenteras=0;
    String texto="select * from x1distribucion_laser_artic_insumos_busqueda("+opcion+",'"+textobus.toUpperCase().trim()+"') as (id character varying(16),descripcion character varying(16),itemprov character varying(16),unidad character varying(3),factor numeric,smin numeric,smax numeric,precio numeric);";
    System.out.println(texto);
                    try {
                        rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                        while (rs.next())
                            {
                                    controlfolio=1;
                                    //JOptionPane.showMessageDialog(null,"Articulo Agregado Correctamente", "Sistema Integral(Agregar Articulo) : Confirmacion",1);
                                    piezasxfila=Float.parseFloat(this.jtf_anchomaterial.getText())/rs.getFloat("smin");
                                    //System.out.println(piezasxfila);
                                    puentedetexto=miformat.format(piezasxfila).replace(".", ":").replace(",", ":");
                                    piezasxfilas=puentedetexto.split(":");
                                    System.out.println(piezasxfila);
                                    System.out.println(piezasxfilas[0]);
                                    totfilas=Float.parseFloat(cantidad)/Float.parseFloat(piezasxfilas[0]);
                                    
                                   //System.out.println(totfilas);
                                     puentefnece=miformat.format(totfilas).replace(".", ":").replace(",", ":");
                                     totfilass=puentefnece.split(":");
                                     filasneceenteras=Float.parseFloat(totfilass[0]);
                                     if (totfilas>filasneceenteras)
                                        {
                                            filaajuste=1;
                                        }
                                    puentefnece=miformat.format(Float.parseFloat(totfilass[0])+filaajuste);
                                    alturausada=Float.parseFloat(puentefnece)*rs.getFloat("smax");
                                    this.jtf_insumodescripcion.setText(rs.getString ("descripcion"));
                                    this.jtf_anchopieza.setText(rs.getString("smin"));
                                    this.jtf_altodepieza.setText(rs.getString("smax"));
                                    this.jtf_item.setText(rs.getString("itemprov"));

                                    //System.out.println(alturausada);
                                    //this.jtf_pzasreferencia.setText("1");
                                    //this.jtf_precioinsumo.setText(miformatpre.format(rs.getFloat("precio")));
                                    //this.jtf_segundos.setText(miformatseg.format(rs.getFloat("factor")*60));
                                    //this.jtf_precioinsumo.setText(this.jtf_precioinsumo.getText());
                                    //this.jtf_segundos.setText(this.jtf_factor.getText());
                                    //this.calcularcortexpieza();
                                    //jtable_modelo_maquilla.addRow(new Object[]{rs.getString("id"),rs.getString ("descripcion"),rs.getString ("unidad"),miformat.format(Float.valueOf(this.jtf_factor.getText().toString())*(Float.valueOf(cantidad))),this.jtf_precioinsimo.getText(),this.jtf_descuento.getText().trim(),this.jtf_impuesto.getText().trim(),0,this.jtf_observacion.getText().trim().toUpperCase()+".",cantidad,this.jtf_anchomaterial.getText(),miformat.format(alturausada)+"="+miformat.format(alturausada/100)+" MT",0});
                                    //this.jtf_idinsumo.setText("");
                                    //this.jtf_insumodescripcion.setText("");
                                    //this.jtf_item.setText("");
                                    //totalmatusado=this.jtf_totmaterialusado.getText().split("=");
                                    //this.jtf_totmaterialusado.setText(miformatusado.format(Float.parseFloat(totalmatusado[0].replace(",", "").replace(".",""))+alturausada)+"="+miformat.format((Float.parseFloat(totalmatusado[0].replace(",", "").replace(".",""))+alturausada)/100)+"MT");
                                    //this.jtf_canpzaingresa.requestFocus();
                            }
                        }
                    catch(Exception e)
                        {
                              System.out.println(e.getMessage());
                              JOptionPane.showMessageDialog(null,"Error conexion", "Sistema Integral(Integral) : Error",1);
                        }
                    if (controlfolio == 0 )
                            {
                                        //JOptionPane.showMessageDialog(null,"Error Verifique Articulo", "Sistema Integral(Agregar Insumo) : Error",1);
                                        this.jlbl_mensajeidinsumo.setText("!Nuevo! Ingrese datos");
                                        this.jtf_insumodescripcion.requestFocus();
                                        
                            }
                    else
                            {
                                this.calcularimportes();
                                this.jlbl_mensajeidinsumo.setText("");
                            }
}


private void calcularimportes()
    {
    int numerofilas=this.jtable_modelo_maquilla.getRowCount(),error=0;
    DecimalFormat miformat = new DecimalFormat("############.##");
    String punto="",comas="",imagen="";
    float cantidad=0,costo=0,importefila=0,descuento=0,impuesto=0,doctosubtotal=0,doctoimpuesto=0,doctodescuento=0,doctototal=0,piezasindi=0,piezamaqui=0,piezasmaquiindi=0;
     for(int i = 0 ;i < numerofilas; i++)
                {
                 try
                       {
                            cantidad = Float.valueOf(this.jtb_insumos.getValueAt(i, 3).toString()).floatValue();
                            costo = Float.valueOf(this.jtb_insumos.getValueAt(i, 4).toString()).floatValue();
                            piezasindi+=cantidad;
                            piezamaqui+=Float.valueOf(this.jtb_insumos.getValueAt(i, 9).toString()).floatValue();
                            piezasmaquiindi=Float.valueOf(this.jtb_insumos.getValueAt(i, 9).toString()).floatValue();
                            descuento=(costo*cantidad)*(Float.valueOf(this.jtf_descuento.getText().toString())/100);
                            System.out.println(descuento);
                            impuesto=Float.valueOf(this.jtf_impuesto.getText().toString())/100;
                            System.out.println(descuento+":"+impuesto);
                            importefila=(cantidad*costo);
                            doctodescuento+=descuento;
                            doctosubtotal+=importefila;

                        }
                            catch (NumberFormatException nfe) {
                            cantidad=0;
                            costo=0;
                            error=1;
                        }
                      jtable_modelo_maquilla.setValueAt(miformat.format(importefila), i,7);
                      jtable_modelo_maquilla.setValueAt(miformat.format(importefila/piezasmaquiindi), i,12);
                }
    doctoimpuesto=(doctosubtotal-doctodescuento)*impuesto;
    doctototal=(doctosubtotal-doctodescuento)+doctoimpuesto;
    this.jtf_doctosubtotal.setText(String.valueOf(doctosubtotal));
    this.jtf_doctodesc.setText(String.valueOf(doctodescuento));
    this.jtf_doctoimp.setText(String.valueOf(doctoimpuesto));
    this.jtf_doctototal.setText(String.valueOf(doctototal));
    this.jtf_totalpiezas.setText(String.valueOf(piezasindi));
    this.jtf_cantidadpiezas.setText(String.valueOf(piezamaqui));
    }
private void Limpiar()
    {
    while(jtable_modelo_maquilla.getRowCount()>0)jtable_modelo_maquilla.removeRow(0);
    this.jcmbx_tiendaclie.setSelectedIndex(0);
    this.jcmbx_tipmaquila.setSelectedIndex(0);
    this.jtf_descuento.setText("0");
    this.jtf_impuesto.setText("0");
    this.jtf_observaciones.setText("");
    this.jtf_canpzaingresa.setText("0");
    this.jtf_idinsumo.setText("");
    this.jtf_pzasreferencia.setText("0");
    this.jtf_minutos.setText("0");
    this.jtf_segundos.setText("0");
    this.jtf_insumodescripcion.setText("");
    this.jtf_item.setText("");
    this.jtf_doctosubtotal.setText("0");
    this.jtf_doctodesc.setText("0");
    this.jtf_doctoimp.setText("0");
    this.jtf_doctototal.setText("0");
    this.jtf_totalpiezas.setText("0");
    this.jtf_cantidadpiezas.setText("0");
    this.jtf_totmaterialusado.setText("0=0");

    this.jcmbx_operador.requestFocus();
    }



 private void imprimir(int pag,float ptotal,int folio)
    {
     java.util.Date fechahoya=new Date();
     this.objimpresora=new laser_entradas_imprimir();
     this.objimpresora.setOneItem_cadenas_a_imprimir("Maquila Insumos");
     //this.objimpresora.setOneItem_cadenas_a_imprimir("Fecha:"+this.+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Fecha:"+this.fechaeuropea(this.jdc_fechadocto.getDate())+" "+this.jdc_fechadocto.getDate().getHours()+":"+this.jdc_fechadocto.getDate().getMinutes());
     this.objimpresora.setOneItem_cadenas_a_imprimir("Folio:"+folio+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Status Documento:"+"EN PROCESO"+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Cliente o Tienda:"+this.jcmbx_tiendaclie.getSelectedItem()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Observaciones:"+this.jtf_observaciones.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     this.objimpresora.setOneItem_cadenas_a_imprimir("paginas:"+ pag + " de "+ptotal+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Responsalbe Produccion: ______________");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Empaco: ______________");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Recibio: ______________");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     this.objimpresora.setObjeto_tabla(jtb_insumos);
     this.objimpresora.imprimir_all(1,pag);
    }



    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jpn_encabezado = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jtf_observaciones = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jdc_fechadocto = new com.toedter.calendar.JDateChooser();
        jcmbx_tiendaclie = new javax.swing.JComboBox();
        jcmbx_tipmaquila = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jtf_descuento = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jtf_impuesto = new javax.swing.JTextField();
        jScrollPane3 = new javax.swing.JScrollPane();
        jta_archivo = new javax.swing.JTextArea();
        jLabel24 = new javax.swing.JLabel();
        jbtn_importar = new javax.swing.JButton();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jcmbx_operador = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jtf_idinsumo = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jtf_insumodescripcion = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jtf_item = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jtf_unidadsal = new javax.swing.JTextField();
        jbtn_agregar = new javax.swing.JButton();
        jlbl_mensajeidinsumo = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jtf_canpzaingresa = new javax.swing.JTextField();
        jlbl_costo1 = new javax.swing.JLabel();
        jtf_precioinsumo = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jtf_factor = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jtf_minutosaprox = new javax.swing.JTextField();
        jlbl_costo2 = new javax.swing.JLabel();
        jtf_anchopieza = new javax.swing.JTextField();
        jlbl_costo3 = new javax.swing.JLabel();
        jtf_altodepieza = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jtf_anchomaterial = new javax.swing.JTextField();
        jbtn_buscar = new javax.swing.JButton();
        jLabel20 = new javax.swing.JLabel();
        jtf_pzasreferencia = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jtf_minutos = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jtf_segundos = new javax.swing.JTextField();
        jlbl_costo = new javax.swing.JLabel();
        jtf_precioinsimo = new javax.swing.JTextField();
        jtf_observacion = new javax.swing.JTextField();
        jpn_cuerpo = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtb_insumos = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                //        if (mColIndex < 3)
                return false;
                //    else
                //    return true;
            }
        }
        ;
        jLabel10 = new javax.swing.JLabel();
        jtf_doctosubtotal = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jtf_doctodesc = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jtf_doctoimp = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jtf_doctototal = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        jtf_totalpiezas = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        jtf_cantidadpiezas = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        jtf_totmaterialusado = new javax.swing.JTextField();
        jchbx_eliminarfila = new javax.swing.JCheckBox();
        jtf_veridinsumo = new javax.swing.JTextField();
        jchbx_veridinsumo = new javax.swing.JCheckBox();
        jtf_verinsumodescrip = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        jbtn_guardar = new javax.swing.JButton();
        jbtn_salir = new javax.swing.JButton();
        jbtn_helpayudame = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jmni_guardar = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jmni_buscaarticulo = new javax.swing.JMenuItem();
        jmni_agregararticulo = new javax.swing.JMenuItem();
        jmni_limpiardetalle = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(laser_entradas_agregar.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jpn_encabezado.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jpn_encabezado.border.title"))); // NOI18N
        jpn_encabezado.setName("jpn_encabezado"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jtf_observaciones.setName("jtf_observaciones"); // NOI18N
        jtf_observaciones.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_observacionesActionPerformed(evt);
            }
        });

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jdc_fechadocto.setDateFormatString(resourceMap.getString("jdc_fechadocto.dateFormatString")); // NOI18N
        jdc_fechadocto.setName("jdc_fechadocto"); // NOI18N

        jcmbx_tiendaclie.setName("jcmbx_tiendaclie"); // NOI18N
        jcmbx_tiendaclie.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcmbx_tiendaclieActionPerformed(evt);
            }
        });

        jcmbx_tipmaquila.setName("jcmbx_tipmaquila"); // NOI18N
        jcmbx_tipmaquila.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcmbx_tipmaquilaActionPerformed(evt);
            }
        });

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jtf_descuento.setText(resourceMap.getString("jtf_descuento.text")); // NOI18N
        jtf_descuento.setName("jtf_descuento"); // NOI18N
        jtf_descuento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_descuentoActionPerformed(evt);
            }
        });
        jtf_descuento.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jtf_descuentoFocusLost(evt);
            }
        });

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jtf_impuesto.setText(resourceMap.getString("jtf_impuesto.text")); // NOI18N
        jtf_impuesto.setName("jtf_impuesto"); // NOI18N
        jtf_impuesto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_impuestoActionPerformed(evt);
            }
        });
        jtf_impuesto.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jtf_impuestoFocusLost(evt);
            }
        });

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        jta_archivo.setColumns(20);
        jta_archivo.setRows(5);
        jta_archivo.setName("jta_archivo"); // NOI18N
        jScrollPane3.setViewportView(jta_archivo);

        jLabel24.setText(resourceMap.getString("jLabel24.text")); // NOI18N
        jLabel24.setToolTipText(resourceMap.getString("jLabel24.toolTipText")); // NOI18N
        jLabel24.setName("jLabel24"); // NOI18N

        jbtn_importar.setIcon(resourceMap.getIcon("jbtn_importar.icon")); // NOI18N
        jbtn_importar.setText(resourceMap.getString("jbtn_importar.text")); // NOI18N
        jbtn_importar.setToolTipText(resourceMap.getString("jbtn_importar.toolTipText")); // NOI18N
        jbtn_importar.setName("jbtn_importar"); // NOI18N
        jbtn_importar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_importarActionPerformed(evt);
            }
        });

        jLabel26.setText(resourceMap.getString("jLabel26.text")); // NOI18N
        jLabel26.setToolTipText(resourceMap.getString("jLabel26.toolTipText")); // NOI18N
        jLabel26.setName("jLabel26"); // NOI18N

        jLabel27.setText(resourceMap.getString("jLabel27.text")); // NOI18N
        jLabel27.setName("jLabel27"); // NOI18N

        jcmbx_operador.setName("jcmbx_operador"); // NOI18N
        jcmbx_operador.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcmbx_operadorActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpn_encabezadoLayout = new javax.swing.GroupLayout(jpn_encabezado);
        jpn_encabezado.setLayout(jpn_encabezadoLayout);
        jpn_encabezadoLayout.setHorizontalGroup(
            jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_descuento, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_impuesto, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel4)
                        .addGap(18, 18, 18)
                        .addComponent(jtf_observaciones, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jdc_fechadocto, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                        .addComponent(jLabel27)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jcmbx_operador, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcmbx_tiendaclie, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jcmbx_tipmaquila, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel24)
                    .addComponent(jbtn_importar)
                    .addComponent(jLabel26)))
        );
        jpn_encabezadoLayout.setVerticalGroup(
            jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcmbx_operador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel27)
                    .addComponent(jLabel3)
                    .addComponent(jcmbx_tiendaclie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcmbx_tipmaquila, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
                        .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(jtf_descuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9)
                            .addComponent(jtf_impuesto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_observaciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                        .addGap(71, 71, 71))
                    .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jdc_fechadocto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                        .addGap(71, 71, 71))))
            .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                .addComponent(jLabel24)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel26)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtn_importar)
                .addContainerGap(63, Short.MAX_VALUE))
            .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N

        jtf_idinsumo.setToolTipText(resourceMap.getString("jtf_idinsumo.toolTipText")); // NOI18N
        jtf_idinsumo.setName("jtf_idinsumo"); // NOI18N
        jtf_idinsumo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_idinsumoActionPerformed(evt);
            }
        });

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        jtf_insumodescripcion.setToolTipText(resourceMap.getString("jtf_insumodescripcion.toolTipText")); // NOI18N
        jtf_insumodescripcion.setName("jtf_insumodescripcion"); // NOI18N
        jtf_insumodescripcion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_insumodescripcionActionPerformed(evt);
            }
        });

        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N

        jtf_item.setToolTipText(resourceMap.getString("jtf_item.toolTipText")); // NOI18N
        jtf_item.setName("jtf_item"); // NOI18N
        jtf_item.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_itemActionPerformed(evt);
            }
        });

        jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
        jLabel17.setName("jLabel17"); // NOI18N

        jtf_unidadsal.setText(resourceMap.getString("jtf_unidadsal.text")); // NOI18N
        jtf_unidadsal.setName("jtf_unidadsal"); // NOI18N
        jtf_unidadsal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_unidadsalActionPerformed(evt);
            }
        });

        jbtn_agregar.setIcon(resourceMap.getIcon("jbtn_agregar.icon")); // NOI18N
        jbtn_agregar.setText(resourceMap.getString("jbtn_agregar.text")); // NOI18N
        jbtn_agregar.setName("jbtn_agregar"); // NOI18N
        jbtn_agregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_agregarActionPerformed(evt);
            }
        });

        jlbl_mensajeidinsumo.setFont(resourceMap.getFont("jlbl_mensajeidinsumo.font")); // NOI18N
        jlbl_mensajeidinsumo.setText(resourceMap.getString("jlbl_mensajeidinsumo.text")); // NOI18N
        jlbl_mensajeidinsumo.setName("jlbl_mensajeidinsumo"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jtf_canpzaingresa.setText(resourceMap.getString("jtf_canpzaingresa.text")); // NOI18N
        jtf_canpzaingresa.setToolTipText(resourceMap.getString("jtf_canpzaingresa.toolTipText")); // NOI18N
        jtf_canpzaingresa.setName("jtf_canpzaingresa"); // NOI18N
        jtf_canpzaingresa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_canpzaingresaActionPerformed(evt);
            }
        });

        jlbl_costo1.setText(resourceMap.getString("jlbl_costo1.text")); // NOI18N
        jlbl_costo1.setName("jlbl_costo1"); // NOI18N

        jtf_precioinsumo.setEditable(false);
        jtf_precioinsumo.setText(resourceMap.getString("jtf_precioinsumo.text")); // NOI18N
        jtf_precioinsumo.setName("jtf_precioinsumo"); // NOI18N
        jtf_precioinsumo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_precioinsumoActionPerformed(evt);
            }
        });

        jLabel21.setText(resourceMap.getString("jLabel21.text")); // NOI18N
        jLabel21.setName("jLabel21"); // NOI18N

        jtf_factor.setEditable(false);
        jtf_factor.setText(resourceMap.getString("jtf_factor.text")); // NOI18N
        jtf_factor.setName("jtf_factor"); // NOI18N

        jLabel22.setText(resourceMap.getString("jLabel22.text")); // NOI18N
        jLabel22.setName("jLabel22"); // NOI18N

        jtf_minutosaprox.setEditable(false);
        jtf_minutosaprox.setText(resourceMap.getString("jtf_minutosaprox.text")); // NOI18N
        jtf_minutosaprox.setName("jtf_minutosaprox"); // NOI18N

        jlbl_costo2.setText(resourceMap.getString("jlbl_costo2.text")); // NOI18N
        jlbl_costo2.setName("jlbl_costo2"); // NOI18N

        jtf_anchopieza.setText(resourceMap.getString("jtf_anchopieza.text")); // NOI18N
        jtf_anchopieza.setName("jtf_anchopieza"); // NOI18N
        jtf_anchopieza.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_anchopiezaActionPerformed(evt);
            }
        });

        jlbl_costo3.setText(resourceMap.getString("jlbl_costo3.text")); // NOI18N
        jlbl_costo3.setName("jlbl_costo3"); // NOI18N

        jtf_altodepieza.setText(resourceMap.getString("jtf_altodepieza.text")); // NOI18N
        jtf_altodepieza.setName("jtf_altodepieza"); // NOI18N
        jtf_altodepieza.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_altodepiezaActionPerformed(evt);
            }
        });

        jLabel23.setText(resourceMap.getString("jLabel23.text")); // NOI18N
        jLabel23.setName("jLabel23"); // NOI18N

        jtf_anchomaterial.setText(resourceMap.getString("jtf_anchomaterial.text")); // NOI18N
        jtf_anchomaterial.setToolTipText(resourceMap.getString("jtf_anchomaterial.toolTipText")); // NOI18N
        jtf_anchomaterial.setName("jtf_anchomaterial"); // NOI18N
        jtf_anchomaterial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_anchomaterialActionPerformed(evt);
            }
        });

        jbtn_buscar.setIcon(resourceMap.getIcon("jbtn_buscar.icon")); // NOI18N
        jbtn_buscar.setText(resourceMap.getString("jbtn_buscar.text")); // NOI18N
        jbtn_buscar.setName("jbtn_buscar"); // NOI18N
        jbtn_buscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_buscarActionPerformed(evt);
            }
        });

        jLabel20.setText(resourceMap.getString("jLabel20.text")); // NOI18N
        jLabel20.setName("jLabel20"); // NOI18N

        jtf_pzasreferencia.setText(resourceMap.getString("jtf_pzasreferencia.text")); // NOI18N
        jtf_pzasreferencia.setToolTipText(resourceMap.getString("jtf_pzasreferencia.toolTipText")); // NOI18N
        jtf_pzasreferencia.setName("jtf_pzasreferencia"); // NOI18N
        jtf_pzasreferencia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_pzasreferenciaActionPerformed(evt);
            }
        });

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jtf_minutos.setText(resourceMap.getString("jtf_minutos.text")); // NOI18N
        jtf_minutos.setToolTipText(resourceMap.getString("jtf_minutos.toolTipText")); // NOI18N
        jtf_minutos.setName("jtf_minutos"); // NOI18N
        jtf_minutos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_minutosActionPerformed(evt);
            }
        });

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jtf_segundos.setText(resourceMap.getString("jtf_segundos.text")); // NOI18N
        jtf_segundos.setToolTipText(resourceMap.getString("jtf_segundos.toolTipText")); // NOI18N
        jtf_segundos.setName("jtf_segundos"); // NOI18N
        jtf_segundos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_segundosActionPerformed(evt);
            }
        });

        jlbl_costo.setText(resourceMap.getString("jlbl_costo.text")); // NOI18N
        jlbl_costo.setName("jlbl_costo"); // NOI18N

        jtf_precioinsimo.setText(resourceMap.getString("jtf_precioinsimo.text")); // NOI18N
        jtf_precioinsimo.setToolTipText(resourceMap.getString("jtf_precioinsimo.toolTipText")); // NOI18N
        jtf_precioinsimo.setName("jtf_precioinsimo"); // NOI18N
        jtf_precioinsimo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_precioinsimoActionPerformed(evt);
            }
        });

        jtf_observacion.setText(resourceMap.getString("jtf_observacion.text")); // NOI18N
        jtf_observacion.setName("jtf_observacion"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(255, 255, 255)
                        .addComponent(jlbl_mensajeidinsumo))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jLabel15)
                            .addGap(10, 10, 10)
                            .addComponent(jtf_insumodescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel16)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_item, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl_costo2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_anchopieza, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl_costo3)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_altodepieza, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jlbl_costo1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_precioinsumo, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jLabel17)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_unidadsal, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel21)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jtf_factor, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jbtn_agregar, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                            .addGap(6, 6, 6)
                            .addComponent(jLabel22)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_minutosaprox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(3, 3, 3)
                            .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jtf_anchomaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jLabel1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_canpzaingresa, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel14)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_idinsumo, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel20)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_pzasreferencia, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel5)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_minutos, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel8)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_segundos, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl_costo)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_precioinsimo, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_observacion, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jbtn_buscar, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(38, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addGap(22, 22, 22)
                        .addComponent(jlbl_mensajeidinsumo))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jtf_idinsumo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jtf_minutosaprox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel22)
                        .addComponent(jtf_canpzaingresa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel14)
                        .addComponent(jtf_pzasreferencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel20)
                        .addComponent(jLabel5)
                        .addComponent(jtf_minutos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel8)
                        .addComponent(jtf_segundos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jlbl_costo)
                        .addComponent(jtf_precioinsimo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jtf_observacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jbtn_buscar))
                    .addComponent(jLabel1)
                    .addComponent(jtf_anchomaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(jtf_insumodescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15)
                    .addComponent(jtf_item, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl_costo1)
                    .addComponent(jtf_precioinsumo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_unidadsal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17)
                    .addComponent(jLabel21)
                    .addComponent(jtf_factor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl_costo2)
                    .addComponent(jtf_anchopieza, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl_costo3)
                    .addComponent(jtf_altodepieza, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtn_agregar))
                .addGap(5, 5, 5))
        );

        jpn_cuerpo.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jpn_cuerpo.border.title"))); // NOI18N
        jpn_cuerpo.setName("jpn_cuerpo"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jtb_insumos.setModel(this.jtable_modelo_maquilla);
        jtb_insumos.setName("jtb_insumos"); // NOI18N
        jtb_insumos.setRowHeight(22);
        jtb_insumos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jtb_insumosMouseClicked(evt);
                if(evt.getClickCount() >= 1)
                {
                    dioclick(evt);
                }
            }
        });
        jtb_insumos.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jtb_insumosPropertyChange(evt);
            }
        });
        jScrollPane1.setViewportView(jtb_insumos);

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        jtf_doctosubtotal.setEditable(false);
        jtf_doctosubtotal.setName("jtf_doctosubtotal"); // NOI18N

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        jtf_doctodesc.setEditable(false);
        jtf_doctodesc.setName("jtf_doctodesc"); // NOI18N

        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N

        jtf_doctoimp.setEditable(false);
        jtf_doctoimp.setName("jtf_doctoimp"); // NOI18N

        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N

        jtf_doctototal.setEditable(false);
        jtf_doctototal.setName("jtf_doctototal"); // NOI18N

        jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
        jLabel18.setName("jLabel18"); // NOI18N

        jtf_totalpiezas.setEditable(false);
        jtf_totalpiezas.setText(resourceMap.getString("jtf_totalpiezas.text")); // NOI18N
        jtf_totalpiezas.setName("jtf_totalpiezas"); // NOI18N

        jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N
        jLabel19.setName("jLabel19"); // NOI18N

        jtf_cantidadpiezas.setEditable(false);
        jtf_cantidadpiezas.setName("jtf_cantidadpiezas"); // NOI18N

        jLabel25.setText(resourceMap.getString("jLabel25.text")); // NOI18N
        jLabel25.setName("jLabel25"); // NOI18N

        jtf_totmaterialusado.setEditable(false);
        jtf_totmaterialusado.setText(resourceMap.getString("jtf_totmaterialusado.text")); // NOI18N
        jtf_totmaterialusado.setName("jtf_totmaterialusado"); // NOI18N

        jchbx_eliminarfila.setText(resourceMap.getString("jchbx_eliminarfila.text")); // NOI18N
        jchbx_eliminarfila.setName("jchbx_eliminarfila"); // NOI18N
        jchbx_eliminarfila.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jchbx_eliminarfilaActionPerformed(evt);
            }
        });

        jtf_veridinsumo.setEditable(false);
        jtf_veridinsumo.setText(resourceMap.getString("jtf_veridinsumo.text")); // NOI18N
        jtf_veridinsumo.setName("jtf_veridinsumo"); // NOI18N

        jchbx_veridinsumo.setText(resourceMap.getString("jchbx_veridinsumo.text")); // NOI18N
        jchbx_veridinsumo.setName("jchbx_veridinsumo"); // NOI18N
        jchbx_veridinsumo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jchbx_veridinsumoActionPerformed(evt);
            }
        });

        jtf_verinsumodescrip.setEditable(false);
        jtf_verinsumodescrip.setText(resourceMap.getString("jtf_verinsumodescrip.text")); // NOI18N
        jtf_verinsumodescrip.setName("jtf_verinsumodescrip"); // NOI18N

        javax.swing.GroupLayout jpn_cuerpoLayout = new javax.swing.GroupLayout(jpn_cuerpo);
        jpn_cuerpo.setLayout(jpn_cuerpoLayout);
        jpn_cuerpoLayout.setHorizontalGroup(
            jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                        .addComponent(jchbx_eliminarfila)
                        .addGap(25, 25, 25)
                        .addComponent(jtf_veridinsumo, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jtf_verinsumodescrip, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jchbx_veridinsumo)
                        .addGap(429, 429, 429))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1021, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                        .addComponent(jLabel18)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jtf_totalpiezas, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(25, 25, 25)
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_doctosubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_doctodesc, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_doctoimp, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_doctototal, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_cantidadpiezas, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel25)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_totmaterialusado, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jpn_cuerpoLayout.setVerticalGroup(
            jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jchbx_eliminarfila)
                    .addComponent(jtf_veridinsumo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jchbx_veridinsumo)
                    .addComponent(jtf_verinsumodescrip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jtf_totalpiezas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(jtf_doctosubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11)
                    .addComponent(jtf_doctodesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(jtf_doctoimp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13)
                    .addComponent(jtf_doctototal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel19)
                    .addComponent(jtf_cantidadpiezas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel25)
                    .addComponent(jtf_totmaterialusado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setName("jPanel1"); // NOI18N

        jbtn_guardar.setIcon(resourceMap.getIcon("jbtn_guardar.icon")); // NOI18N
        jbtn_guardar.setText(resourceMap.getString("jbtn_guardar.text")); // NOI18N
        jbtn_guardar.setName("jbtn_guardar"); // NOI18N
        jbtn_guardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_guardarActionPerformed(evt);
            }
        });

        jbtn_salir.setIcon(resourceMap.getIcon("jbtn_salir.icon")); // NOI18N
        jbtn_salir.setText(resourceMap.getString("jbtn_salir.text")); // NOI18N
        jbtn_salir.setName("jbtn_salir"); // NOI18N
        jbtn_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_salirActionPerformed(evt);
            }
        });

        jbtn_helpayudame.setIcon(resourceMap.getIcon("jbtn_helpayudame.icon")); // NOI18N
        jbtn_helpayudame.setText(resourceMap.getString("jbtn_helpayudame.text")); // NOI18N
        jbtn_helpayudame.setName("jbtn_helpayudame"); // NOI18N
        jbtn_helpayudame.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_helpayudameActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jbtn_guardar)
                .addGap(105, 105, 105)
                .addComponent(jbtn_salir)
                .addGap(130, 130, 130)
                .addComponent(jbtn_helpayudame)
                .addContainerGap(491, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jbtn_helpayudame)
                .addComponent(jbtn_salir)
                .addComponent(jbtn_guardar))
        );

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jmni_guardar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.ALT_MASK));
        jmni_guardar.setText(resourceMap.getString("jmni_guardar.text")); // NOI18N
        jmni_guardar.setName("jmni_guardar"); // NOI18N
        jmni_guardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_guardarActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_guardar);

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F7, 0));
        jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N
        jMenuItem2.setName("jMenuItem2"); // NOI18N
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jmni_buscaarticulo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.CTRL_MASK));
        jmni_buscaarticulo.setText(resourceMap.getString("jmni_buscaarticulo.text")); // NOI18N
        jmni_buscaarticulo.setName("jmni_buscaarticulo"); // NOI18N
        jmni_buscaarticulo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_buscaarticuloActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_buscaarticulo);

        jmni_agregararticulo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.ALT_MASK));
        jmni_agregararticulo.setText(resourceMap.getString("jmni_agregararticulo.text")); // NOI18N
        jmni_agregararticulo.setName("jmni_agregararticulo"); // NOI18N
        jmni_agregararticulo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_agregararticuloActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_agregararticulo);

        jmni_limpiardetalle.setText(resourceMap.getString("jmni_limpiardetalle.text")); // NOI18N
        jmni_limpiardetalle.setName("jmni_limpiardetalle"); // NOI18N
        jmni_limpiardetalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_limpiardetalleActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_limpiardetalle);

        jMenuBar1.add(jMenu2);

        jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N
        jMenu3.setName("jMenu3"); // NOI18N
        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jpn_encabezado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jpn_cuerpo, javax.swing.GroupLayout.DEFAULT_SIZE, 1037, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jpn_encabezado, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jpn_cuerpo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
         if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0)
            {
                 this.dispose();
            }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jtf_observacionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_observacionesActionPerformed
        // TODO add your handling code here:
        this.jtf_canpzaingresa.requestFocus();
}//GEN-LAST:event_jtf_observacionesActionPerformed

    private void jcmbx_tiendaclieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbx_tiendaclieActionPerformed
        // TODO add your handling code here:
       this.jcmbx_tipmaquila.requestFocus();
    }//GEN-LAST:event_jcmbx_tiendaclieActionPerformed

    private void jcmbx_tipmaquilaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbx_tipmaquilaActionPerformed
        // TODO add your handling code here:
        this.jtf_descuento.requestFocus();
}//GEN-LAST:event_jcmbx_tipmaquilaActionPerformed

    private void jtf_descuentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_descuentoActionPerformed
        // TODO add your handling code here:
        this.jtf_impuesto.requestFocus();
}//GEN-LAST:event_jtf_descuentoActionPerformed

    private void jtf_descuentoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtf_descuentoFocusLost
        // TODO add your handling code here:
}//GEN-LAST:event_jtf_descuentoFocusLost

    private void jtf_impuestoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_impuestoActionPerformed
        // TODO add your handling code here:
        this.jtf_observaciones.requestFocus();
}//GEN-LAST:event_jtf_impuestoActionPerformed

    private void jtf_impuestoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtf_impuestoFocusLost
        // TODO add your handling code here:
}//GEN-LAST:event_jtf_impuestoFocusLost

    private void jtf_idinsumoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_idinsumoActionPerformed
        // TODO add your handling code here:

        //this.jtf_insumodescripcion.requestFocus();
        //this.jbtn_buscarActionPerformed(evt);
        this.jbtn_buscarActionPerformed(evt);
        this.jtf_pzasreferencia.requestFocus();

       // this.articulo_busqueda();
    }//GEN-LAST:event_jtf_idinsumoActionPerformed

    private void jtf_insumodescripcionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_insumodescripcionActionPerformed
        // TODO add your handling code here:
        this.jtf_item.requestFocus();
}//GEN-LAST:event_jtf_insumodescripcionActionPerformed

    private void jtf_itemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_itemActionPerformed
        // TODO add your handling code here:

        this.jtf_anchopieza.requestFocus();
        
}//GEN-LAST:event_jtf_itemActionPerformed

    private void jtf_unidadsalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_unidadsalActionPerformed
        // TODO add your handling code here:
        this.jbtn_agregar.requestFocus();
}//GEN-LAST:event_jtf_unidadsalActionPerformed

    private void jbtn_agregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregarActionPerformed
        // TODO add your handling code here:
    if ((this.jtf_idinsumo.getText().toString().length()>0) && (this.jtf_insumodescripcion.getText().toString().length()>2) && (this.jtf_item.getText().toString().length()>0) && (this.jtf_unidadsal.getText().toString().length()>0))
        {
            String minu="",cantidadarreglo="",codigoi="";
            minu=this.jtf_minutosaprox.getText();
            cantidadarreglo=this.jtf_canpzaingresa.getText();
            codigoi=this.jtf_idinsumo.getText();
            this.articulo_agregar(codigoi,cantidadarreglo,minu);
        }
    else
        {
            JOptionPane.showMessageDialog(null,"Favor de Verificar los campos antes de Agregar el Articulo", "Sistema Integral(Agregar Articulo) : Error",1);
        }
}//GEN-LAST:event_jbtn_agregarActionPerformed

    private void jtb_insumosPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jtb_insumosPropertyChange
        // TODO add your handling code here:
        this.calcularimportes();
}//GEN-LAST:event_jtb_insumosPropertyChange

    private void jbtn_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_guardarActionPerformed
        // TODO add your handling code here:
        float tpiezas=Float.valueOf(this.jtf_totalpiezas.getText().trim());
        int index=this.jcmbx_tiendaclie.getSelectedIndex();
        int indexope=this.jcmbx_operador.getSelectedIndex();
        if ((index>0)  && (tpiezas>0) && (indexope>0)) {
            this.documento_guardar();

            System.out.println("se guarda");
        } else {
            JOptionPane.showMessageDialog(null,"Favor de Verificar cliente,operador,tipo de maquila etc", "Sistema Integral(Agregar Produccion) : Error",1);
        }
    }//GEN-LAST:event_jbtn_guardarActionPerformed

    private void jbtn_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_salirActionPerformed
        // TODO add your handling code here:
        //x.cierraConexion();
      if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0)
            {
                 this.dispose();
            }
}//GEN-LAST:event_jbtn_salirActionPerformed

    private void jbtn_helpayudameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_helpayudameActionPerformed
        // TODO add your handling code here:
        //  this.ayuda();
}//GEN-LAST:event_jbtn_helpayudameActionPerformed

    private void jbtn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarActionPerformed
        // TODO add your handling code here:
        String minu="",cantidadarreglo="",codigoi="";
        minu=this.jtf_minutosaprox.getText();
        cantidadarreglo=this.jtf_canpzaingresa.getText();
        codigoi=this.jtf_idinsumo.getText();
        float precio=Float.valueOf(this.jtf_precioinsumo.getText());
       
                if(JOptionPane.showConfirmDialog(null, "<html><b><h3>Pz="+cantidadarreglo+" Precio="+this.jtf_precioinsumo.getText()+"</h3></b> Desea Agregar este Articulo?</html>")==0)
                    {
                        //this.calcularcortexpieza();
                        this.articulo_buscar(1, codigoi, cantidadarreglo,minu);
                    }
                  else
                    {
                        this.jtf_canpzaingresa.requestFocus();
                    }
      

        
    }//GEN-LAST:event_jbtn_buscarActionPerformed

    private void jtf_precioinsimoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_precioinsimoActionPerformed
        // TODO add your handling code here:
        //this.jtf_unidadsal.requestFocus();
        this.jbtn_buscarActionPerformed(evt);
    }//GEN-LAST:event_jtf_precioinsimoActionPerformed

    private void jmni_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_guardarActionPerformed
        // TODO add your handling code here:
        this.jbtn_guardarActionPerformed(evt);
    }//GEN-LAST:event_jmni_guardarActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        this.jbtn_guardarActionPerformed(evt);
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jmni_buscaarticuloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_buscaarticuloActionPerformed
        // TODO add your handling code here:
        this.jbtn_buscarActionPerformed(evt);
    }//GEN-LAST:event_jmni_buscaarticuloActionPerformed

    private void jmni_agregararticuloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_agregararticuloActionPerformed
        // TODO add your handling code here:
        this.jbtn_agregarActionPerformed(evt);
    }//GEN-LAST:event_jmni_agregararticuloActionPerformed

    private void jtf_precioinsumoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_precioinsumoActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jtf_precioinsumoActionPerformed

    private void jtf_segundosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_segundosActionPerformed
        // TODO add your handling code here:
        this.calcularcortexpieza();
        this.jtf_precioinsimo.requestFocus();
    }//GEN-LAST:event_jtf_segundosActionPerformed

    private void jtf_canpzaingresaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_canpzaingresaActionPerformed
        // TODO add your handling code here:
        this.jtf_idinsumo.requestFocus();
    }//GEN-LAST:event_jtf_canpzaingresaActionPerformed

    private void jtf_pzasreferenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_pzasreferenciaActionPerformed
        // TODO add your handling code here:
        this.jtf_minutos.requestFocus();
    }//GEN-LAST:event_jtf_pzasreferenciaActionPerformed

    private void jtf_minutosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_minutosActionPerformed
        // TODO add your handling code here:
        this.jtf_segundos.requestFocus();
    }//GEN-LAST:event_jtf_minutosActionPerformed

    private void jtf_anchopiezaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_anchopiezaActionPerformed
        // TODO add your handling code here:
        this.jtf_altodepieza.requestFocus();
}//GEN-LAST:event_jtf_anchopiezaActionPerformed

    private void jtf_altodepiezaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_altodepiezaActionPerformed
        // TODO add your handling code here:
        this.jtf_unidadsal.requestFocus();
}//GEN-LAST:event_jtf_altodepiezaActionPerformed

    private void jtf_anchomaterialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_anchomaterialActionPerformed
        // TODO add your handling code here:
        this.jtf_canpzaingresa.requestFocus();
}//GEN-LAST:event_jtf_anchomaterialActionPerformed

    private void jbtn_importarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_importarActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Importar Estos Articulos?")==0) {
            String arreglo_importa[]=this.jta_archivo.getText().split("\n");
            String arreglo_codigo[]=null;
            System.out.println("Estos tiene archivo:"+arreglo_importa.length);
            for (int i=0;i<arreglo_importa.length;i++) {
                arreglo_codigo=arreglo_importa[i].split("\t");
                this.jtf_anchomaterial.setText(arreglo_codigo[0]);
                this.jtf_idinsumo.setText(arreglo_codigo[1]);
                this.jtf_canpzaingresa.setText(arreglo_codigo[2]);
                if(arreglo_codigo.length>3)
                    {
                        this.jtf_pzasreferencia.setText(arreglo_codigo[3]);
                        this.jtf_segundos.setText(arreglo_codigo[4]);
                        this.jtf_precioinsimo.setText(arreglo_codigo[5]);

                        this.jtf_observacion.setText(arreglo_codigo[6]);
                        this.calcularcortexpieza();
                    }
                this.articulo_buscar(1, arreglo_codigo[1], arreglo_codigo[2],this.jtf_minutosaprox.getText());
                this.jbtn_agregarActionPerformed(evt);
               
            }
            this.jta_archivo.setText("");
            this.jtf_canpzaingresa.setText("0");
            this.jtf_idinsumo.setText("");
            this.jtf_idinsumo.requestFocus();

        }
}//GEN-LAST:event_jbtn_importarActionPerformed

    private void jmni_limpiardetalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_limpiardetalleActionPerformed
        // TODO add your handling code here:
       if(JOptionPane.showConfirmDialog(null, "Desea Limpiar Documento?")==0)
        {
            while(jtable_modelo_maquilla.getRowCount()>0)jtable_modelo_maquilla.removeRow(0);
            this.jtf_totalpiezas.setText("0");
            this.jtf_totmaterialusado.setText("0");
            this.jtf_cantidadpiezas.setText("0");
            this.jtf_doctosubtotal.setText("0");
            this.jtf_doctodesc.setText("0");
            this.jtf_doctoimp.setText("0");
            this.jtf_doctototal.setText("0");
            this.jtf_cantidadpiezas.setText("0");
            this.jtf_anchomaterial.requestFocus();
        }

    }//GEN-LAST:event_jmni_limpiardetalleActionPerformed

    private void jchbx_eliminarfilaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jchbx_eliminarfilaActionPerformed
        // TODO add your handling code here:
        int fila = jtb_insumos.getSelectedRow();
        if(JOptionPane.showConfirmDialog(null, "Desea Eliminar Fila Seleccionada?")==0)
            {
                jtable_modelo_maquilla.removeRow(fila);
            }

    }//GEN-LAST:event_jchbx_eliminarfilaActionPerformed

    private void jchbx_veridinsumoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jchbx_veridinsumoActionPerformed
        // TODO add your handling code here:
        laser_entradas_catalogo_patrones_detalle flecpd=new laser_entradas_catalogo_patrones_detalle(1,this.jtf_veridinsumo.getText(),this.jtf_verinsumodescrip.getText());
        flecpd.pack();
        flecpd.setVisible(true);
    }//GEN-LAST:event_jchbx_veridinsumoActionPerformed

    private void jcmbx_operadorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbx_operadorActionPerformed
        // TODO add your handling code here:
        this.jcmbx_tiendaclie.requestFocus();
}//GEN-LAST:event_jcmbx_operadorActionPerformed
private void jtb_insumosMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }

private String fechaamericana(Date fe) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fe);
       return cadenafecha;
    }
private String  fechaeuropea(Date fecha) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fecha);
       return cadenafecha;

    }
private void dioclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
            System.out.println("dio doble  click en subfamilia");
            int fila = jtb_insumos.getSelectedRow();

            this.jtf_veridinsumo.setText(this.jtable_modelo_maquilla.getValueAt(fila, 0).toString());
            this.jtf_verinsumodescrip.setText(this.jtable_modelo_maquilla.getValueAt(fila, 1).toString());
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new laser_entradas_agregar().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JButton jbtn_agregar;
    private javax.swing.JButton jbtn_buscar;
    private javax.swing.JButton jbtn_guardar;
    private javax.swing.JButton jbtn_helpayudame;
    private javax.swing.JButton jbtn_importar;
    private javax.swing.JButton jbtn_salir;
    private javax.swing.JCheckBox jchbx_eliminarfila;
    private javax.swing.JCheckBox jchbx_veridinsumo;
    private javax.swing.JComboBox jcmbx_operador;
    private javax.swing.JComboBox jcmbx_tiendaclie;
    private javax.swing.JComboBox jcmbx_tipmaquila;
    private com.toedter.calendar.JDateChooser jdc_fechadocto;
    private javax.swing.JLabel jlbl_costo;
    private javax.swing.JLabel jlbl_costo1;
    private javax.swing.JLabel jlbl_costo2;
    private javax.swing.JLabel jlbl_costo3;
    private javax.swing.JLabel jlbl_mensajeidinsumo;
    private javax.swing.JMenuItem jmni_agregararticulo;
    private javax.swing.JMenuItem jmni_buscaarticulo;
    private javax.swing.JMenuItem jmni_guardar;
    private javax.swing.JMenuItem jmni_limpiardetalle;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JPanel jpn_cuerpo;
    private javax.swing.JPanel jpn_encabezado;
    private javax.swing.JTextArea jta_archivo;
    private javax.swing.JTable jtb_insumos;
    private javax.swing.JTextField jtf_altodepieza;
    private javax.swing.JTextField jtf_anchomaterial;
    private javax.swing.JTextField jtf_anchopieza;
    private javax.swing.JTextField jtf_canpzaingresa;
    private javax.swing.JTextField jtf_cantidadpiezas;
    private javax.swing.JTextField jtf_descuento;
    private javax.swing.JTextField jtf_doctodesc;
    private javax.swing.JTextField jtf_doctoimp;
    private javax.swing.JTextField jtf_doctosubtotal;
    private javax.swing.JTextField jtf_doctototal;
    private javax.swing.JTextField jtf_factor;
    private javax.swing.JTextField jtf_idinsumo;
    private javax.swing.JTextField jtf_impuesto;
    private javax.swing.JTextField jtf_insumodescripcion;
    private javax.swing.JTextField jtf_item;
    private javax.swing.JTextField jtf_minutos;
    private javax.swing.JTextField jtf_minutosaprox;
    private javax.swing.JTextField jtf_observacion;
    private javax.swing.JTextField jtf_observaciones;
    private javax.swing.JTextField jtf_precioinsimo;
    private javax.swing.JTextField jtf_precioinsumo;
    private javax.swing.JTextField jtf_pzasreferencia;
    private javax.swing.JTextField jtf_segundos;
    private javax.swing.JTextField jtf_totalpiezas;
    private javax.swing.JTextField jtf_totmaterialusado;
    private javax.swing.JTextField jtf_unidadsal;
    private javax.swing.JTextField jtf_veridinsumo;
    private javax.swing.JTextField jtf_verinsumodescrip;
    // End of variables declaration//GEN-END:variables
    private laser_entradas_imprimir objimpresora;
}
